package config

import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
)

var mConfig = new(config)

type config struct {
	Programs []program `yaml:"programs"`
}

func Init(file string) {
	configFile, err := ioutil.ReadFile(file)
	if err != nil {
		panic(err.Error())
	}
	if err = yaml.Unmarshal(configFile, mConfig); err != nil {
		panic(err.Error())
	}
}

func Config() *config {
	return mConfig
}
